package demo5;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Component
//@Repository
//@Service
//@Controller
public class Person {
    //@Autowired
    //可以在Resource中传入name参数，制定依赖的类的名字（首字母大小写）
    //@Resource(name = "sweater")
    //@Resource(name = "shirt")
    //private Clothes clothes;

    //可以根据属性名与依赖的类名进行装配:拼写要一致，这里的属性名仅首字母小写
    @Resource
    //private Clothes sweater;
    private Clothes shirt;
    public void play(){
        //clothes.wear();
        //sweater.wear();
        shirt.wear();
        System.out.println("出去玩");
    }
}
